-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input Interaction: better horizontal edge detection #14462
Conversation
1d13528
to
cdbe050
Compare
Tried this patch on an empty paragraph and a table (as in the original issue):
As for the down/up keys: I've tested tables in office applications (writer, spreadsheets). There, the arrow down moves to the cell below instead of to the right cell (and the arrow up to the cell above instead of the left cell). Although I think that would be the desirable behavior, this is great progress and should be fine to track that in a different issue if you think it's better. Tested on Firefox 66 and Chrome 71, Linux OS. |
@nosolosw Thanks for testing. It's definitely not easy to fix it for Firefox, as it totally mispositions the caret rectangle sometimes. I'll see if I can make a more reliable calculation. Regarding the up and down arrows working differently in a table, I think this is a separate issue, but worth fixing in a separate PR. The problem is that we first look in the DOM for a tabbable element, then calculate the new caret position. |
But that confirms again that we shouldn't be looking in the DOM when repositioning the caret with arrow up/down. ;) |
Maybe these functions are also in the wrong package... :/ |
3d6ff67
to
dc9694c
Compare
@nosolosw I fixed vertical edge as well, and also merged the logic. |
Thanks for reviewing @nosolosw! I addressed your feedback. |
eafa076
to
78480a1
Compare
@@ -148,7 +148,7 @@ _Parameters_ | |||
|
|||
_Returns_ | |||
|
|||
- `boolean`: True if at the edge, false if not. | |||
- `boolean`: True if at the vertical edge, false if not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it lovely that we don't have to remember to update this? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes keyboard navigation a pleasure! 🌟
Created #14675 for the UP/DOWN navigation within a table block. |
Thanks for your review! ✨ |
* Input Interaction: better horizontal edge detection * Correct BR ranges * Add e2e test * Increase buffer for Firefox * Clean up * Merge isEdge logic * Fix typo * Address feedback * Build docs
* RichText: improve format boundary style (#14519) * RichText: improve format boundary style * rgb => rgba * Paste: check plain text for gutenberg content (#14536) * Make ClipboardButton inside a block work correctly in Safari (#7106) * Make ClipboardButton inside a block work in Safari * Update changelogs * Block Editor: Update "Next" to "Unreleased" per guidelines https://github.com/WordPress/gutenberg/blob/master/packages/README.md#maintaining-changelogs * Input Interaction: always expand single line selection vertically (#14487) * Input Interaction: always expand single line selection vertically * Add e2e test * Use MenuItem instead of IconButton (#14569) * Remove id, infoid, label and aria-describedby from MenuItem (#14423) * Preformatted: save line breaks as characters (#14653) * Preformatted: save line breaks as characters * Update e2e test * Remove negative toolbar position rules from full-aligned blocks. (#14669) * Fix issue with double scrollbar in Fullscreen Mode (#14677) This PR fixes an issue where the sidebar would have two scrollbars when in fullscreen mode. * Fix WordPress embed block resolution (#14658) * Retry failing embeds with trailing slash (#14705) * Fix embedding Twitter URLs with a trailing slash (Closes #12664) * Fix race condition for WordPress URLs that end in slashes, add test * API Fetch: Fix error on empty OPTIONS preload data (#14714) * Input Interaction: better horizontal edge detection (#14462) * Input Interaction: better horizontal edge detection * Correct BR ranges * Add e2e test * Increase buffer for Firefox * Clean up * Merge isEdge logic * Fix typo * Address feedback * Build docs * Fix memize option key typo (#14750) * RichText: unify active formats, 'selectedFormat' and 'placeholderFormat' (#14411) * RichText: unify active formats, 'selectedFormat' and 'placeholderFormat' * Add extra e2e test * Only should boundary style when focused * Update docs * Try to trigger tests with Travis * Restore Travis config
Description
Fixes #12114.
Fixes horizontal arrow navigation in empty containers. To reproduce, create an empty paragraph block and try to use the left/right arrow keys.
This completely rewrites
isHorizontalEdge
to check visual position instead of DOM position, just likeisVerticalEdge
.How has this been tested?
Screenshots
Types of changes
Checklist: